<html>
<head>
    <meta charset="UTF-8"/>
</head>
<body>
<input type="button" id="btn" value="获取验证码" onclick="time(this)"/>
<script type="text/javascript">
    var waitTime = 60;
    function time(element) {
        if (waitTime === 0) {
            element.removeAttribute("disabled");
            element.value = "获取验证码";
            waitTime = 60;
        } else {
            element.setAttribute("disabled", true);
            element.value = "重新发送(" + waitTime + ")";
            waitTime--;
            setTimeout(function () {
                time(element)
            }, 1000)
        }
    }
</script>

</body>
</html>